feat(analytics): report to collect.mindshub.ai and send an identifying agent (ENG-1355) - #611
feat(analytics): report to collect.mindshub.ai and send an identifying agent (ENG-1355)#611lucas-koontz wants to merge 1 commit into
Conversation
…g agent The four ANTONAPP_* install events have never reached PostHog. The collector they were pointed at matched a lowercase anton_ prefix on the action name, the match is case sensitive, and these names are uppercase, so every one of them was discarded behind an HTTP 200 that sendEvent never reads. Repointing at the new collector, which applies no action filter, is what makes them arrive. The request now carries an explicit user agent as well: Cloudflare's bot protection answers script-shaped agents with 403 on the mindshub.ai zone, and this function throws its response away, so a blocked event leaves no trace. src/main/** has no OTA path, so this reaches users only through a new installer download. Since these events are already dark, nothing regresses in the meantime. Adds this file's first tests, and a README section separating the main-process install beacon from the renderer's product analytics, including the missing installation id that leaves those events unattributable. Lucas Koontz ENG-1355 - Analytics collector lambda silently drops turn_completed and its properties Refs: ENG-1355
No PR environment for this pull requestAdd the Updated on every push to this PR. |
EntelligenceAI PR SummaryUpdated main-process install analytics to send flowchart TD
classDef newBehavior fill:#dcfce7,stroke:#16a34a,color:#14532d;
App["Desktop app"] --> Analytics["sendEvent"]
Analytics --> Request["HTTPS GET with event data and User-Agent"]
Request --> Collector["collect.mindshub.ai/collect"]
Collector --> PostHog["PostHog install events"]
class Analytics,Request,Collector newBehavior;
Review Scorecard
Safe to merge — this is a clean, low-blast-radius analytics change. The install reporting now targets the maintainable Key Findings:
Evaluated against
|
User story
As a whoever is asked how many people finish the installer, accept terms, or pick BYOK
I want the desktop app's four install events to actually arrive in PostHog
So that the onboarding funnel can be answered from data rather than guessed at
Why this matters
None of the four
ANTONAPP_*events has ever reached PostHog. The collector they were pointed at relayed an event only when its action name started with a lowercaseanton_ords_connect_, and that match is case sensitive. These names are uppercase, so every one of them was discarded. The endpoint answered HTTP 200 while doing it, andsendEventreads no response, so nothing anywhere reported it.This was found while fixing the same defect for anton's per-turn cost event, which is the ticket's original subject. The blast radius turned out to include the install funnel.
What happens today
flowchart LR I["installer.ts:563<br/>ANTONAPP_INSTALLATION_SUCCESS"] --> S["sendEvent"] X["index.ts:1146-1151<br/>TERMS_ACCEPTED, MINDSLLM, BYOK"] --> S S --> L{"zoomInfoCollector"} L -->|"action starts with lowercase<br/>anton_ or ds_connect_"| P["PostHog 355390"] L -->|"ANTONAPP_* is uppercase,<br/>so it never matches"| D["discarded"] D --> R["HTTP 200"] R --> Q["sendEvent discards the response.<br/>Four events, zero rows, no signal."]What should happen
flowchart LR I["installer.ts:563<br/>ANTONAPP_INSTALLATION_SUCCESS"] --> S["sendEvent, User-Agent set"] X["index.ts:1146-1151<br/>TERMS_ACCEPTED, MINDSLLM, BYOK"] --> S S --> L{"collect.mindshub.ai"} L -->|"no action filter,<br/>properties minus a denylist"| P["PostHog 355390"] L --> M["EventsRelayed counter<br/>plus a Slack alarm"]What changed
src/main/analytics.tsANALYTICS_URLpoints athttps://collect.mindshub.ai/collect; the request sendsUser-Agent: cowork-analytics/1.0.src/main/analytics.test.tsREADME.mdThe README section exists because these two paths get conflated. The renderer has
posthog-jskeyed on the signed-in Keycloak user and configured byVITE_POSTHOG_MINDSHUB_MAIN_PROJECT_TOKEN. The main process has this beacon, which identifies nothing and is configured by a constant. Anyone debugging "why is this event missing" needs to know which one they are looking at.One gap recorded, not fixed here.
sendEventsends no installation fingerprint, unlike anton'ssend_event, which sendsaid. So these four events cannot be attributed to a machine. The collector groups them under one synthetic id and stampsaid_missingon them so the gap is queryable rather than invisible. Sending an install id is a small follow-up and is deliberately outside this change.Rollout, which is different here
src/main/**has no OTA path, so this constant reaches users only when they download a new installer. That is worth saying out loud because it means the fix lands slowly. It costs nothing, though: these events are already dark for every existing install, so nothing regresses while the change propagates, and every new installer from here reports correctly.Acceptance criteria
ANTONAPP_INSTALLATION_SUCCESSrow in project 355390 within 60 seconds.ANTONAPP_TERMS_ACCEPTED; each provider choice producesANTONAPP_MINDSLLMorANTONAPP_BYOK.aid_missingset, and adistinct_idthat is the collector's synthetic id rather than a real fingerprint.sendEventthrows nothing when the endpoint is unreachable or refuses the request.How to test
curl -s "https://collect.mindshub.ai/collect?action=ANTONAPP_TERMS_ACCEPTED&aid=qaprobe1355"returningrelayed: true. That call alone proves the case-sensitivity fix, since the same request against the old endpoint returnsposthogResult: false.npm run pack, clear install state per the README's fresh-install reset (anton-reset --deep), and run the app through first-run.select event, properties.aid_missing from events where event like 'ANTONAPP%' order by timestamp desc limit 10. Expect one row per step above.ANALYTICS_URLat an unroutable host in a local build and confirm first-run completes with no error surfaced.Verified locally
npm testnpm run typecheckBoth re-run after rebasing onto current
staging, which needed annpm installfor a dependency added in the meantime.Ships with
Refs ENG-1355